package com.wuhan.config;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class CustomRouteConfig {

    @Bean
    public RouteLocator customRoute(RouteLocatorBuilder builder) {
        return builder.routes()
                .route("ai-server", r -> r.path("/api/test/**")
                        .filters(f -> f.stripPrefix(0)).uri("lb://ai-server"))

                .route("ai-admin", r -> r.path("/health/test/**")
                        .filters(f -> f.stripPrefix(0)).uri("lb://ai-admin"))
                .build();
    }

}
